<html>


<form name="form">

Health (in hearts): <input type="TEXT" name="health" value="10" size=3>

<br><br>

Weapon Type:

<select name="wmat">
<option value="0" selected>Wood/Gold
<option value="1">Stone
<option value="2">Iron
<option value="3">Diamond
</select>

<select name="weapon">
<option value="5" selected>Sword
<option value="4">Axe
<option value="3">Pickaxe
<option value="2">Shovel
<option value="1">Other/Fists
</select>

&nbsp;&nbsp;&nbsp;Sharpness Level: <input type="TEXT" name="sharp" value="0" size=3>
<br><br>

Helmet:
<select name="hmat">
<option value="0" selected>None
<option value="1">Leather
<option value="2">Gold
<option value="2">Chain
<option value="2">Iron
<option value="3">Diamond
</select>
Protection Level: <input type="TEXT" name="hprot" value="0" size=3>
<br>


Chest:
<select name="cmat">
<option value="0" selected>None
<option value="3">Leather
<option value="5">Gold
<option value="5">Chain
<option value="6">Iron
<option value="8">Diamond
</select>
Protection Level: <input type="TEXT" name="cprot" value="0" size=3>

<br>

Pants:
<select name="pmat">
<option value="0" selected>None
<option value="2">Leather
<option value="3">Gold
<option value="4">Chain
<option value="5">Iron
<option value="6">Diamond
</select>
Protection Level: <input type="TEXT" name="pprot" value="0" size=3>

<br>

Boots:
<select name="bmat">
<option value="0" selected>None
<option value="1">Leather
<option value="1">Gold
<option value="1">Chain
<option value="2">Iron
<option value="3">Diamond
</select>
Protection Level: <input type="TEXT" name="bprot" value="0" size=3>

<br>
<br>


<input type="BUTTON" value="Calculate Power Level" onClick="Go()"/>


<br>
<br>

Weapon Damage: <input type="TEXT" name="dmg" value="" readonly>
<br>
Armor damage reduction: <input type="TEXT" name="red" value="" readonly>
<br>
<br>
Power Level: <input type="TEXT" name="pl" value="" readonly>
</form>








<script>
document.form.dmg.value = "";
document.form.red.value = "";
document.form.pl.value = "";

function Go()
{
    
    var health = document.form.health.value;


    var dmg = parseInt(document.form.weapon.value);

    if (dmg > 1)
        dmg += parseInt(document.form.wmat.value);

    dmg /= 2;

    dmg += .625 * parseInt(document.form.sharp.value);

    document.form.dmg.value = dmg;


    var defense_points = parseInt(document.form.hmat.value) +
                         parseInt(document.form.cmat.value) +
                         parseInt(document.form.pmat.value) +
                         parseInt(document.form.bmat.value);

    var ph = parseInt(document.form.hprot.value);
    var pc = parseInt(document.form.cprot.value);
    var pp = parseInt(document.form.pprot.value);
    var pb = parseInt(document.form.bprot.value);

    var epf = 0;
    if (ph > 0) epf += Math.floor((6+ph*ph)/4);
    if (pc > 0) epf += Math.floor((6+pc*pc)/4);
    if (pp > 0) epf += Math.floor((6+pp*pp)/4);
    if (pb > 0) epf += Math.floor((6+pb*pb)/4);
    alert(epf);

    epf = Math.min(Math.ceil(Math.min(epf, 25) * .75), 20);

    var red = 1 - (1 - .04 * defense_points) * (1 - .04 * epf);
    document.form.red.value = red;


    document.form.pl.value = health * dmg / (1-red);

}



</script>





</html>